package com.wx.exam.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @Author ychiha
 * @Date 2021/11/28 16:28
 * @Version 1.0
 */
@Configuration
public class FileUploadConfig implements WebMvcConfigurer {

    /***
     * 添加文件处理器
     * @param registry
     */
    public void addResourceHandlers(ResourceHandlerRegistry registry){

        //addResourceHandler:浏览器访问的路径            addResourceLocations：本地路径
        registry.addResourceHandler("/dynamicimg/**").addResourceLocations("file:D:\\study\\大四上\\考试\\微信小程序资源\\dynamicimg\\");
        registry.addResourceHandler("/background/**").addResourceLocations("file:D:\\study\\大四上\\考试\\微信小程序资源\\background\\");
        registry.addResourceHandler("/mp4/**").addResourceLocations("file:D:\\study\\大四上\\考试\\微信小程序资源\\mp4\\");
        registry.addResourceHandler("/userimg/**").addResourceLocations("file:D:\\study\\大四上\\考试\\微信小程序资源\\userimg\\");

    }

}
